// builder_prim.h: Header for class implementing Prim's algorithm adapted for maze generation.
// Written by Victor Luna Freire - victorclf@live.com
// Copyright (c) Victor Luna Freire. All rights reserved.
// Sunday, October 25, 2009 8:08:23 PM

#ifndef BUILDER_PRIM_H_218371293718
#define BUILDER_PRIM_H_218371293718

#include "builder.h"

// Builder implemented with Prim.
class BuilderPrim : public Builder {
	std::vector< std::string > cellmaze; // a cell maze is a virtual maze that keeps tracks of the processed cells. It does not contain any walls.
	std::vector< std::pair<Vec2i, Vec2i> > adj_cells; // adjacent cells list
		
	// Get root vertex for maze generation. 
	Vec2i get_start_cell();

public:
	// Construct BuilderPrim of width and height.
	BuilderPrim::BuilderPrim(int width, int height);
	
	// Start building maze with adapted Prim's algorithm.
	void start_process();
	// Perform the next step in the build. Returns false if the build is over. Starts the building if it was not started before.
	bool next_step();
	// Is the maze built?
	bool is_done() const { return !maze.empty() && adj_cells.empty(); };
	
};



#endif // BUILDER_PRIM_H_218371293718